package com.example.ruanjian2012.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class PageController {


    @RequestMapping("/")
    public String getIndex(){
        System.out.println("进入方法了");
        return "index";
    }
    
    
    

    @RequestMapping("/hello")
    public String gethello(){
        System.out.println("进入方法了");
        return "hello";
    }


    @RequestMapping("/product")
    public String getproduct(){
        System.out.println("进入方法了");
        return "product";
    }



    @RequestMapping("/addCar")
    public String getaddCar(){
        System.out.println("进入方法了");
        return "addCar";
    }
    


    //使用requestParam注解获取

    @RequestMapping("/login")
    public String login(@RequestParam("username") String username,
                        @RequestParam("password") String password){
        System.out.println("拿到账号名字为:"+username);
        System.out.println("拿到密码为:"+password);
        System.out.println("进入方法了");
        return "hello";
    }
}
